# -*- coding: utf-8 -*-
"""
Created on Wed May  8 09:40:27 2019

@author: yaoyu
"""

import pandas as pd
import numpy as np

def main():
    d = pd.Series(range(20))
    print(d)
    print(d.cumsum())
    
    s = pd.Series(25, index=['a','b','c','d'])
    print(s)
    
    d = pd.Series({'a':9, 'b':8, 'c':7})
    print(d)
    
    e = pd.Series({'a':9, 'b':8, 'c':7}, index=['c','a','b','d'])
    print(e)
    
    n = pd.Series(np.arange(5))
    print(n)
    
    m = pd.Series(np.arange(5), index=np.arange(9,4,-1))
    print(m)
    
    b = pd.Series([9,8,7,6],index=list('abcd'))
    print(b)
    print(b.index)
    print(b.values)
    
    print(b['b'])
    print(b[1])
    print(b[['c','d','a']])
    print(b[['c','d',0]])
    
    c = b[b > b.median()]
    print(c)
    
    print(b.name)
    b.name='对象'
    print(b.index.name)
    b.index.name='索引列'
    print(b)
    
if __name__ == '__main__':
    main()
